package cn.gson.fengboot.model.pojos;

import javax.persistence.*;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.Collection;
import java.util.Objects;

@Entity
public class Dbusiness {
    private Integer busId;
    private TfyclientForm client;
    private String busName;
    private String busPossibility;
    private Timestamp busWritten;
    private BigDecimal busMoney;
    private Timestamp busSettime;
    private String busNo;
    private String busPeople;
    private TfylinkmanForm busPrimarycontact;
    private Dphase phase;
    private String busStatu;
    private Timestamp busUptime;

    /*private Collection<Zcontract> zcontractsByBusId;
    private Collection<Zorder> zordersByBusId;*/
    private Collection<Dbuspro> dbuspros;

    @Id
    @Column(name = "bus_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY,generator = "dbusiness")
    public Integer getBusId() {
        return busId;
    }

    public void setBusId(Integer busId) {
        this.busId = busId;
    }

    @ManyToOne
    @JoinColumn(name = "client_id",referencedColumnName = "client_id")
    public TfyclientForm getClient() {
        return client;
    }

    public void setClient(TfyclientForm client) {
        this.client = client;
    }

    @Basic
    @Column(name = "bus_name")
    public String getBusName() {
        return busName;
    }

    public void setBusName(String busName) {
        this.busName = busName;
    }

    @Basic
    @Column(name = "bus_possibility")
    public String getBusPossibility() {
        return busPossibility;
    }

    public void setBusPossibility(String busPossibility) {
        this.busPossibility = busPossibility;
    }

    @Basic
    @Column(name = "bus_written")
    public Timestamp getBusWritten() {
        return busWritten;
    }

    public void setBusWritten(Timestamp busWritten) {
        this.busWritten = busWritten;
    }

    @Basic
    @Column(name = "bus_money")
    public BigDecimal getBusMoney() {
        return busMoney;
    }

    public void setBusMoney(BigDecimal busMoney) {
        this.busMoney = busMoney;
    }

    @Basic
    @Column(name = "bus_settime")
    public Timestamp getBusSettime() {
        return busSettime;
    }

    public void setBusSettime(Timestamp busSettime) {
        this.busSettime = busSettime;
    }

    @Basic
    @Column(name = "bus_no")
    public String getBusNo() {
        return busNo;
    }

    public void setBusNo(String busNo) {
        this.busNo = busNo;
    }

    @Basic
    @Column(name = "bus_people")
    public String getBusPeople() {
        return busPeople;
    }

    public void setBusPeople(String busPeople) {
        this.busPeople = busPeople;
    }


    @ManyToOne
    @JoinColumn(name = "linkman_id",referencedColumnName = "linkman_id")
    public TfylinkmanForm getBusPrimarycontact() {
        return busPrimarycontact;
    }

    public void setBusPrimarycontact(TfylinkmanForm busPrimarycontact) {
        this.busPrimarycontact = busPrimarycontact;
    }


    @OneToMany(mappedBy = "busId")
    public Collection<Dbuspro> getDbuspros() {
        return dbuspros;
    }

    public void setDbuspros(Collection<Dbuspro> dbuspros) {
        this.dbuspros = dbuspros;
    }

    @ManyToOne
    @JoinColumn(name = "phase_id",referencedColumnName = "phase_id")
    public Dphase getPhase() {
        return phase;
    }

    public void setPhase(Dphase phase) {
        this.phase = phase;
    }


    @Basic
    @Column(name = "bus_statu")
    public String getBusStatu() {
        return busStatu;
    }

    public void setBusStatu(String busStatu) {
        this.busStatu = busStatu;
    }


    @Basic
    @Column(name = "bus_uptime")
    public Timestamp getBusUptime() {
        return busUptime;
    }

    public void setBusUptime(Timestamp busUptime) {
        this.busUptime = busUptime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Dbusiness dbusiness = (Dbusiness) o;
        return busId == dbusiness.busId &&
                Objects.equals(client, dbusiness.client) &&
                Objects.equals(busName, dbusiness.busName) &&
                Objects.equals(busPossibility, dbusiness.busPossibility) &&
                Objects.equals(busWritten, dbusiness.busWritten) &&
                Objects.equals(busMoney, dbusiness.busMoney) &&
                Objects.equals(busSettime, dbusiness.busSettime) &&
                Objects.equals(busNo, dbusiness.busNo) &&
                Objects.equals(busPeople, dbusiness.busPeople);
    }

    @Override
    public int hashCode() {
        return Objects.hash(busId, client, busName, busPossibility, busWritten, busMoney, busSettime, busNo, busPeople);
    }

    @Override
    public String toString() {
        return "Dbusiness{" +
                "busId=" + busId +
                ", client=" + client +
                ", busName='" + busName + '\'' +
                ", busPossibility='" + busPossibility + '\'' +
                ", busWritten=" + busWritten +
                ", busMoney=" + busMoney +
                ", busSettime=" + busSettime +
                ", busNo='" + busNo + '\'' +
                ", busPeople='" + busPeople + '\'' +
                ", busPrimarycontact=" + busPrimarycontact +
                ", phase=" + phase +
                ", dbuspros=" + dbuspros +
                '}';
    }
}
